ColorStack = {}
function PushColor(color)
	ColorStack[table.getn(ColorStack) + 1] = color
end
function PopColor()
	local color = ColorStack[table.getn(ColorStack)];
	ColorStack[table.getn(ColorStack)] = nil;
	return color;
end

mainmenu =
{
	controls =
	{
		newparty =
		{
			events =
			{
				up = function()
					UIManager:SelectControl("quit");
				end,
				left = function()
					UIManager:SelectControl("quit");
				end,
				down = function()
					UIManager:SelectControl("loadparty");
				end,
				right = function()
					UIManager:SelectControl("loadparty");
				end,
				selected = function()
					PushColor(SelectedControl:GetChild("txt").Diffuse)
					SelectedControl:GetChild("txt").Diffuse = Color4(1.0, 1.0, 1.0, 0.0);
				end,
				unselected = function()
					SelectedControl:GetChild("txt").Diffuse = PopColor();
				end,
				action = function()
					UI:ActivateScene("newpartymenu", true, false);
				end
			},
		},
		loadparty =
		{
			events =
			{
				up = function()
					UIManager:SelectControl("newparty");
				end,
				left = function()
					UIManager:SelectControl("newparty");
				end,
				down = function()
					UIManager:SelectControl("quit");
				end,
				right = function()
					UIManager:SelectControl("quit");
				end,
				selected = function()
					PushColor(SelectedControl:GetChild("txt").Diffuse)
					SelectedControl:GetChild("txt").Diffuse = Color4(1.0, 1.0, 1.0, 0.0);
				end,
				unselected = function()
					SelectedControl:GetChild("txt").Diffuse = PopColor();
				end,
				action = function()
					UI:ActivateScene("loadpartymenu", true, false);
				end
			},
		},
		options =
		{
			events =
			{
				selected = function()
					PushColor(SelectedControl:GetChild("txt").Diffuse)
					SelectedControl:GetChild("txt").Diffuse = Color4(1.0, 1.0, 1.0, 0.0);
				end,
				unselected = function()
					SelectedControl:GetChild("txt").Diffuse = PopColor();
				end,
			},
		},
		quit =
		{
			events =
			{
				up = function()
					UIManager:SelectControl("loadparty");
				end,
				left = function()
					UIManager:SelectControl("loadparty");
				end,
				down = function()
					UIManager:SelectControl("newparty");
				end,
				right = function()
					UIManager:SelectControl("newparty");
				end,
				selected = function()
					PushColor(SelectedControl:GetChild("txt").Diffuse)
					SelectedControl:GetChild("txt").Diffuse = Color4(1.0, 1.0, 1.0, 0.0);
				end,
				unselected = function()
					SelectedControl:GetChild("txt").Diffuse = PopColor();
				end,
				action = function()
					Application.Quit = true;
				end
			},
		},
	},
}
